package com.qijian.enums;

import com.qijian.common.exception.ServiceException;
import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum InventoryArrangeEnum {

    HARDWARE("五金", "五金库"), PLATE("钢板", "钢板库"), SECTION("型材", "型材库"), PAINT("油漆", "油漆库");

    private String name;

    private String warehouse;

    public static InventoryArrangeEnum getType(String originalFilename) {
        for (InventoryArrangeEnum arrangeEnum : InventoryArrangeEnum.values()) {
            if (originalFilename.contains(arrangeEnum.name)) {
                return arrangeEnum;
            }

        }
        throw new ServiceException("EX0:文件名未包含五金、板材、型材、油漆任意一种，无法分辨类型");
    }


}
